require "model/Configure"
require "TaskXMLParser"

class MainUI < Gtk::Window
	CONFIG_PATH = "configure.xml"
	include GetText
	GetText.bindtextdomain("SmarTask", "locale", nil, "utf-8")
	GetText.locale=TaskXMLParser.new.getConfigure(MainUI::CONFIG_PATH).language
	def initialize context

    super "SmarTask"
    
    uicontext = UIContext.new
    uicontext.context = context
		uicontext.resourcesPath = "../resources/"
    uicontext.menuItemsManager = MenuItemsManager.new uicontext
    uicontext.listPanelManager = ListPanelManager.new
    uicontext.treePanelManager = TreePanelManager.new uicontext
		uicontext.window = self
    
    taskMenuBarManager = TaskMenuBarManager.new uicontext
    mouseRightMenuManger = MouseRightMenuManager.new uicontext
    #mouseRightMenuManger.registerPopupMenu2ListPanel
    mouseRightMenuManger.registerPopupMenu2TreePanel
    StatusiconManager.new uicontext

		tabs = Gtk::Notebook.new
		#tabs.append_page uicontext.listPanelManager.getListPanel,Gtk::Label.new("Task List", true)
		tabs.append_page uicontext.treePanelManager.getTreePanel,Gtk::Label.new(GLib.locale_to_utf8(_("Task Tree")), true)

		box = Gtk::VBox.new
		box.pack_start taskMenuBarManager.getTaskMenuBar,false,false,0
		box.pack_start tabs,true,true,0
    add box
		
		signal_connect("destroy") { Gtk.main_quit }
    signal_connect("window-state-event") { |win, event|
    }
    window_position = Gtk::Window::POS_CENTER
		set_default_size 400, 300
		show_all
	end
end